﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HDFSViewer.Utility
{
    public static class EncodingUtility
    {
        public static Encoding ConvertEncoding(string name)
        {
            switch (name)
            {
                case "ASCII":
                    return Encoding.ASCII;
                case "UTF8":
                    return Encoding.UTF8;
                case "Unicode":
                    return Encoding.Unicode;
                case "GB2312":
                    return Encoding.GetEncoding("gb2312");
                case "GBK":
                    return Encoding.GetEncoding("gbk");
                case "BigEndianUnicode":
                    return Encoding.BigEndianUnicode;
                case "UTF32":
                    return Encoding.UTF32;
                case "UTF7":
                    return Encoding.UTF7;
            }
            return Encoding.Default;
        }
    }
}
